package IO;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import  java.io.LineNumberReader;

/**
 * @ClassName : LineNumberReader
 * @Author : LV88VL
 * @Date: 2021/3/16 8:23
 * @Description : 行号读取
 */
public class LineNumberReaderDemo {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("D://a.txt");
        LineNumberReader lnr = new LineNumberReader(fr);
        String line= null;
        while ((line=lnr.readLine())!=null){
            System.out.println(lnr.getLineNumber()+"========="+line);
        }
        lnr.close();
    }


}
